package com.woniu.client;

import com.woniu.dto.TUserDto;
import com.woniu.dto.UserAddressDto;
import com.woniu.model.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.math.BigDecimal;

/**
 * 调用用户地址的服务
 */
@FeignClient(name = "user-server",path = "/user")
public interface TUserClient {
    /**
     * 根据地址id查询地址信息
     * @param addressId
     * @return
     */
    @GetMapping("/userAddrees/addressById/{addressId}")
    public Result<UserAddressDto> addressById(@PathVariable("addressId") Long addressId);
    /**
     * 根据用户id查询用户的默认地址信息
     * @param userId 用户id
     * @return
     */
    @GetMapping("/userAddrees/addressByUserId.api/{userId}")
    @ApiOperation("根据用户id查询用户的默认地址信息")
    public Result<UserAddressDto> addressByUserId(@PathVariable("userId") Integer userId);

    /**
     * 根据id查询用户
     * @param userId 用户id
     * @return
     */
    @GetMapping("/tUser/userById/{userId}.api")
    @ApiOperation("根据id查询用户")
    public Result<TUserDto> userById(@PathVariable("userId") Long userId);
    /**
     * 修改用户积分
     * @param userId 用户id
     * @param score 要修改的积分
     * @return
     */
    @GetMapping("/tUser/modifyScore.api/{userId}/{score}")
    public Result<TUserDto> modifyScore(@PathVariable("userId") Integer userId,@PathVariable("score") BigDecimal score);
}
